<?php
 /***************************************************************
 * Mor-MVC Framework, A framework that can easily let you build a powerful
 * and scalable web application based on PHP language,
 * this framewrok is a copy of the Zend Behavior Framework
 *  Copyright (C) 2010  Nabil Droussi <nabildroussi@gmail.com>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ***************************************************************/
require_once("RL/TemplateProvider.php");
require_once("misc/ClassLoader.php");

class FrontControllerAction
{
	protected $_request = null;
	protected $_template = null;
	private $_actionName = "";
	private $_controllerName = "";
	public function __construct()
	{
            $this->_request = new HttpRequest();
            $this->_template = new TemplateProvider();
            ClassLoader::load("DAL_CommandExecutor");
            ClassLoader::load("misc_Utility");
	}
	public function getTemplate()
	{
		return $this->_template;
	}
	public function setActionName($actionName)
	{
		$this->_actionName = $actionName;
	}
	public function getActionName()
	{
		return $this->_actionName;
	}
	public function setControllerName($controllerName)
	{
		$this->_controllerName = $controllerName;
	}
	public function getControllerName()
	{
		return $this->_controllerName;
	}
	public function setTemplateDirectory($dir)
	{
		$this->_template->setTemplateDirectory($dir."/".strtolower($this->_controllerName));
	}
	public function parse()
	{
                $this->_request->addHeader("Content-type","text/html; charset=UTF-8");
		$this->_template->setTemplateFile($this->_actionName);
		$this->_template->parse();
	}
	public function getRequest()
	{
		return $this->_request;
	}
	public function init(){}
	public function preDispatch(){}
}
